<?php
    $fileName = $_GET['file'];
	
	$count = $_GET['count'];
	
	$file = fopen($fileName, 'w') or die("Error opening file.");
	
	$dataToWrite = "";
	
	for ($counter = 0; $counter < $count; $counter++)
	{
		$identifier = "data" . "$counter";
		$tempData = $_GET[$identifier];
		$dataToWrite .= "$tempData" . "\n";
	}
	
	fwrite($file, "$dataToWrite");
	
	fclose($file);
?>
